﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <script type="text/javascript" src="lib/PIE_IE678.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.7/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="lib/icheck/icheck.css" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>估价列表</title>
</head>
<body>
    <!--top 导航-->
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 估价列表 <span class="c-gray en">&gt;</span> 房产基本信息登记 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>

    <!--Main 估价列表-->
    <div class="page-container">
        <div class="cl pd-5 bg-1 bk-gray mt-20">
            <span class="l">
                <a class="btn btn-primary radius" onclick="pledge_add('房产登记', 'AddUser.html')" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 登记</a>
                <input type="text" name="" id="number_search" placeholder="请输入报告编号查询" style="width:250px" class="input-text">
                <button name="" id="" class="btn btn-success" type="button" onclick="search()"><i class="Hui-iconfont">&#xe665;</i> 搜估价</button>
            </span>
            <!--<span class="r">共有数据：<strong>54</strong> 条</span>-->
        </div>
        <div class="mt-20">
            <table class="table table-border table-bordered table-bg table-hover table-sort">
                <thead>
                    <tr class="text-c">
                        <th width="80">项目号</th>
                        <th width="80">看房联系人</th>
                        <th width="100">看房联系人电话</th>
                        <th width="300">房屋坐落</th>
                        <th width="120">登记日期</th>
                        <th width="100">项目状态</th>
                        <th width="100">操作</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
        </div>
    </div>

    <!--模态框-->
    <script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="lib/layer/2.1/layer.js"></script>
    <script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
    <!-- <script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>-->  <!--分页脚本，暂时注释-->
    <script type="text/javascript" src="static/h-ui/js/H-ui.js"></script>
    <script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script>
    <!--域名配置-->
    <script type="text/javascript" src="static/WebApi.js"></script>
    <script type="text/javascript">
        var StateList = Array();

        /*估价信息-显示*/
        $(function () {
            getStateList();//获取枚举定义的状态
            listShow();
        });

        //获取枚举定义的状态
        function getStateList() {
            $.ajax({
                type: "post",
                url: ApiUrl + "api/trackRecord/GetSelectState",
                async: false,
                success: function (data) {
                    $(data).each(function () {
                        StateList[this.value] = this.text;
                    })
                },
                error: function (e) {
                    parent.layer.msg('网络链接超时...!', { icon: 2, time: 1000 });
                }
            });
        };

        //根据项目号模糊查询，显示估价列表信息
        function listShow(T_ReportNumber) {
            $.ajax({
                type: "post",
                url: ApiUrl + "api/Personal/SelectPersonalAll",
                data: { "": T_ReportNumber },
                success: function (data, status) {//'+ item.P_ReportNumber + '
                    if (status == "success") {
                        $("tbody").empty();
                        var html = Array();
                        $(data).each(function (i, item) {
                            var T_State = StateList[item.T_State];
                            html.push('<tr class="text-c">');
                            html.push('<td> ');
                            html.push('<a class="btn btn-primary radius" data-title="勘查信息" _href="Base.html?' + item.T_ReportNumber + '" onclick="Hui_admin_tab(this)" href="javascript:;">' + item.T_ReportNumber + '</a></td>');
                            html.push('<td>' + item.T_Linkman + '</td>');
                            html.push('<td>' + item.T_Phone + '</td>');
                            html.push('<td>' + item.T_Located + '</td>');
                            html.push('<td>' + new Date(item.T_Date).Format("yyyy-MM-dd hh:mm:ss") + '</td>');
                            html.push('<td>' + T_State + '</td>');
                            html.push('     <td class="f-14 td-manage">');
                            if (item.T_State == 0) {
                                html.push('<a class="btn btn-success radius" onclick="pledge_edit(\'编辑\', \'AddUser.html\', \'' + item.T_ReportNumber + '\')" title="未勘查预约之前可编辑">编辑</a>');
                                html.push('<a class="btn btn-success radius" onclick="pledge_del(this, ' + item.T_ReportNumber + ')" title="未勘查预约之前可删除">删除</a>');
                            }
                            if (item.T_State > 4) {
                                html.push('<a class="btn btn-success radius" title="导出抵押物初审意见书" onclick="download_Initia_laudit(' + item.T_ReportNumber + ')">导出</a>');
                            }
                            if (item.T_State > 6) {
                                html.push(' <a class="btn btn-success radius" title="导出正式评估报告书" onclick="download_Formal_audit(' + item.T_ReportNumber + ')">导出</a>');
                            }

                            html.push('</td>');
                            html.push('</tr>');
                        });
                        $("tbody").append(html.join(""));
                    }
                },
                error: function (e) {
                    layer.msg('服务器链接超时!', { icon: 2, time: 5000 });
                    //$("tbody").html("");
                },
                complete: function () {
                }
            });
        }


        //查询功能
        function search() {
            var T_ReportNumber = $("#number_search").val();
            listShow(T_ReportNumber);
        }


        /*估价信息-排序【报告号】*/
        //$('.table-sort').dataTable({
        //    "aaSorting": [[1, "desc"]],//默认第几个排序
        //    "bStateSave": true,//状态保存
        //    "aoColumnDefs": [
        //      { "orderable": false, "aTargets": [1, 2, 3, 4, 5] }// 制定列不参与排序
        //    ]
        //});

        /*房产抵押基本信息-登记*/
        function pledge_add(title, url) {
            var index = layer.open({
                type: 2,
                title: title,
                content: url
            });
            layer.full(index);
        }
        /*勘查信息完善-打开*/
        //Hui_admin_tab

        /*房产抵押基本信息-编辑*/
        function pledge_edit(title, url, id) {
            var index = layer.open({
                type: 2,
                title: title,
                content: url + "?" + id
            });
            layer.full(index);
        }
        /*房产抵押基本信息-删除-未预约勘查信息之前可以删除*/
        function pledge_del(obj, id) {
            if (layer.confirm('确认要删除吗？')) {
                $.ajax({
                    type: "post",
                    url: ApiUrl + "api/Personal/delete",
                    data: { "": id },
                    //contentType: 'application/json',
                    success: function (data, status) {
                        if (status == "success") {
                            if (data == true) {
                                parent.layer.msg('已删除!', { icon: 1, time: 1000 });
                                $(obj).parents("tr").remove();
                            }
                        }
                    },
                    error: function (e) {
                        parent.layer.msg('服务器链接超时!', { icon: 2, time: 5000 });
                    },
                    complete: function () {

                    }
                });
            };

        };

        /*导出抵押物初审意见书*/
        function download_Initia_laudit(T_ReportNumber) {
            $.ajax({
                url: ApiUrl + "api/Examination/Thetrial",
                type: 'post',
                data: { "": T_ReportNumber },
                success: function (data) {
                    if (data.code == 0) {
                        parent.layer.msg(data.msg, { icon: 2, time: 1000 });
                    }
                    else {
                        parent.layer.msg("导出成功！", { icon: 1, time: 1000 });
                        location.href = "" + ApiUrl + data.msg;
                    }
                },
                error: function () {
                    parent.layer.msg("ajax执行生成文件时报错！", { icon: 2, time: 1000 });
                }
            });
            //location.href=''
        };

        /*导出公积金贷款二手房担保方式正式报告*/
        function download_Formal_audit(T_ReportNumber) {
            $.ajax({
                url: ApiUrl + "api/Examination/lastAudit",
                type: 'post',
                data: { "": T_ReportNumber },
                success: function (data) {
                    if (data.code == 0) {
                        parent.layer.msg(data.msg, { icon: 2, time: 1000 });
                    }
                    else {
                        parent.layer.msg("导出成功！", { icon: 1, time: 1000 });
                        location.href = "" + ApiUrl + data.msg;
                    }
                },
                error: function () {
                    parent.layer.msg("ajax执行生成文件时报错！", { icon: 2, time: 1000 });
                }
            });
            //location.href=''
        };

    </script>
</body>
</html>
